# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2Lifecycle do
  @moduledoc """
  The lifecycle state of an object, such as label, field, or choice. The lifecycle enforces the following transitions: * `UNPUBLISHED_DRAFT` (starting state) * `UNPUBLISHED_DRAFT` -> `PUBLISHED` * `UNPUBLISHED_DRAFT` -> (Deleted) * `PUBLISHED` -> `DISABLED` * `DISABLED` -> `PUBLISHED` * `DISABLED` -> (Deleted) The published and disabled states have some distinct characteristics: * Published—Some kinds of changes might be made to an object in this state, in which case `has_unpublished_changes` will be true. Also, some kinds of changes are not permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label are rejected. * Disabled—When disabled, the configured `DisabledPolicy` takes effect.

  ## Attributes

  *   `disabledPolicy` (*type:* `GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy.t`, *default:* `nil`) - The policy that governs how to show a disabled label, field, or selection choice.
  *   `hasUnpublishedChanges` (*type:* `boolean()`, *default:* `nil`) - Output only. Whether the object associated with this lifecycle has unpublished changes.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state of the object associated with this lifecycle.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :disabledPolicy =>
            GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy.t()
            | nil,
          :hasUnpublishedChanges => boolean() | nil,
          :state => String.t() | nil
        }

  field(:disabledPolicy,
    as: GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy
  )

  field(:hasUnpublishedChanges)
  field(:state)
end

defimpl Poison.Decoder, for: GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2Lifecycle do
  def decode(value, options) do
    GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2Lifecycle.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2Lifecycle do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
